const Router = require('koa-router')
const router = new Router();

let user = [
    {
        username: '17552669975',
        password: '123123'
    },
    {
        username: '123456',
        password: '123456'
    }
]

router.post('/login', async (ctx) => {
    let { username, password } = ctx.request.body;
    let result = user.find(item => item.username == username && item.password == password);
    if (!result) {
        return ctx.body = {
            code: 400,
            msg: '普通用户'
        }
    } else {
        return ctx.body = {
            code: 200,
            msg: '管理员登录成功'
        }
    }
})
module.exports = router;